]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Allow to use the up and down arrows to wrap around
authorLukáš Tyrychtr <lukastyrychtr@gmail.com>
Tue, 1 Nov 2022 15:54:54 +0000 (16:54 +0100)
committerMarge Bot <marge-bot@gnome.org>
Fri, 1 Sep 2023 21:50:12 +0000 (21:50 +0000)
This aligns the keyboard navigation behavior with similar menus in
other desktop environments and with GTK itself.

It allows the users to move in the menu using already known patterns
and makes the operation quicker in some cases, especially as many
users don't know about the tab and shift+tab behavior.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6017

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2525>

js/ui/popupMenu.js

index 53175316195c7a4f805e7091e41d0f2e62ec89d9..60da5460d552d379c9e6fdc3ee784b38f0fc1be1 100644 (file)
@@ -167,6 +167,16 @@ export const PopupBaseMenuItem = GObject.registerClass({
             this.activate(event);
             return Clutter.EVENT_STOP;
         }
+
+        // Support wrapping navigation in the menu
+        if (symbol === Clutter.KEY_Up || symbol === Clutter.KEY_Down) {
+            const group = global.focus_manager.get_group(this);
+            const direction = symbol === Clutter.KEY_Up
+                ? St.DirectionType.UP
+                : St.DirectionType.DOWN;
+            if (group?.navigate_focus(this, direction, true))
+                return Clutter.EVENT_STOP;
+        }
         return Clutter.EVENT_PROPAGATE;
     }